package cn.nebula.music.utils;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

import org.springframework.stereotype.Component;
@Component
public class MD5Utils {
	public static String encrypt(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
		MessageDigest md5 = MessageDigest.getInstance("MD5");
		Base64.Encoder base64Encoder = Base64.getEncoder();
		return base64Encoder.encodeToString(md5.digest(password.getBytes("utf-8")));
	}

}
